// NOLINTBEGIN
#include <cmath>
#include <complex>
#include <iostream>
using namespace std;

int main() {
  double a, b, c;
  double delta;
  complex<double> x1, x2;

  cout << "Tips: ax^2 + bx + c = 0\nEnter a, b, c: \n";
  cin >> a >> b >> c;

  if (a == 0) {
    cout << "Error: a cannot be zero." << endl;
    return 1;
  }

  delta = b * b - 4 * a * c;

  if (delta < 0) {
    cout << "No real roots.\n";
    x1 = complex<double>(-b / (2 * a), sqrt(-delta) / (2 * a));
    x2 = complex<double>(-b / (2 * a), -sqrt(-delta) / (2 * a));
    cout << "Complex root:" << x1 << endl;
    cout << "x1 = " << real(x1) << " + " << imag(x1) << "i" << endl;
    cout << "x2 = " << real(x2) << " + " << imag(x2) << "i" << endl;

  } else if (delta == 0) {
    x1 = -b / (2 * a);
    cout << "One root: x1 = x2 = " << real(x1) << endl;

  } else {
    x1 = (-b + sqrt(delta)) / (2 * a);
    x2 = (-b - sqrt(delta)) / (2 * a);

    cout << "Two roots: x1 = " << real(x1) << " , x2 = " << real(x2) << endl;
  }

  return 0;
}
// NOLINTEND